﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Composite.Events;
using MyPrism.Infrastructure;
using System.ComponentModel;

namespace MyPrism.Employees.ViewModels
{
    public class MainContentViewModel : INotifyPropertyChanged
    {
        private string sampleText;
        public string SampleText
        {
            get
            {
                return this.sampleText;
            }
            set
            {
                this.sampleText = value;
                OnPropertyChanged("SampleText");
            }
        }
        
        public MainContentViewModel(IEventAggregator eventAggregator)
        { 
            eventAggregator.GetEvent<SearchEvents>().Subscribe(OnSearchEvent);
        }

        public void OnSearchEvent(string data)
        {
            SampleText = data;
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
